package cn.hfatec.freemarker;

import cn.hfatec.constants.SysContant;
import cn.hfatec.web.WebContext;
import org.springframework.ui.Model;

import java.util.Map;

/**
 * @author: panwb
 *
 * Date: 2015/3/3
 * Time: 16:16
 */
public class FreeMarkerUtil {

    public static Map render(String name, Model model) throws Exception {
        model.addAttribute(SysContant.ABSOLUTE_CONTEXT_PATH, WebContext.getRequest().getAttribute(SysContant.ABSOLUTE_CONTEXT_PATH));
        return RenderUtil.FREEMAKER_RENDER_UTIL.render(name, model);
    }

    public static String render(String name, Map model) throws Exception {
        return RenderUtil.FREEMAKER_RENDER_UTIL.render(name, model);
    }
}
